<script setup lang="ts">

import {useRouter} from "vue-router";
import Local from "@/utils/local";
import {Message} from "@arco-design/web-vue";

const router = useRouter()



const handleHome = () => {
  const home = Local.localRead('defaultRouter')
  const menuList = JSON.parse(Local.localRead('menuList') || '[]')
  if (menuList.length === 0) {
    Message.warning('当前账号没有菜单，请换个账号重新登录！')
    setTimeout(() => {
      Local.localClear()
      router.push('login')
    }, 500)
    return;
  }
  if (home) {
    router.push(home)
  } else {
    Local.localClear()
    router.push('login')
  }

}
</script>

<template>
  <a-result status="404" subtitle="抱歉，您访问的页面不存在。">
    <template #extra>
      <a-space>
        <a-button type="primary" @click="handleHome">返回首页</a-button>
      </a-space>
    </template>
  </a-result>
</template>

<style scoped lang="scss">

</style>